package guoanmaker.provider.business.model;

import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import guoanmaker.provider.helper.common.abstractobj.IdEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name="t_provide_Commodity")

//@JsonIgnoreProperties(value = {"hibernateLazyInitializer","handler","business"})

public class ProvideCommodity  extends IdEntity{
	private String commodityName; //商品名称
	private String isBargaining; //是否议价 1:议价 2:不可议价
	private Double startingPrice; //议价起始值
	private String invoiceMail;//发票邮寄 1：包邮 2：货到付款
	private String isTerritoryRestriction;//是否有地域限制 1:有 2:没有
	private Integer isPromotion;//是否促销 1:促销 2:不促销
	private Integer commodityCode;//商品编号
	
	private Double commodityPrice; //商品现价
	private Double commodityPricePromotion;//商品促销价
	private Date startTime;//商品促销开始时间
	private Date endTime;//商品促销结束时间
	private String commodity_bigimage;//商品大图
	private String commodity_smallimage;//商品小图
	private String description;//图文描述
	private Integer commodityState;//商品状态 1:待审核 2:审核通过 3:审核失败 4:下架 5:冻结 6:删除状态 7:培训商品删除
	private Date createTime; //创建时间
	private String createName;//创建人
	private Date releaseTime;//发布时间
	private Integer stock;//商品库存
	private Integer populationRestriction;//人数限制
	private Date registrationStartTime;//报名开始时间
	private Date registrationEndTime;//报名结束时间
	private String synopsis;//商品简介
	private String type;//商品所属大类
	private Integer clickRate;//点击量
	private String introduce;//介绍
	private String process;//流程
	private String promise;//承诺
	private String commodityCase;//案例
	private String auditOpinion;//审核意见
	private Double finalPrice;//最终价格
	private Integer evaluateValue;//商品评价数量
	private Integer salesVolume;//商品销售量
	private Integer readState; //阅读状态 1:已阅读 2:未阅读
	private String reasoncontent; //审批内容  商品表
	
	@OneToOne
	private PerviderDictionary measurementUnit;;//计量单位
	
	@ManyToOne(fetch=FetchType.EAGER,optional=true)
	@JoinColumn(name="business_id")
	@JsonIgnoreProperties
	private ProviderBusiness providerBusiness;
	
	@OneToMany(mappedBy="commodity",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
	private List<ProvideCommodityServiceRange> serviceRange;
	
	@OneToOne
	private OperatorServerClass serviceType;//服务类别
	
	@OneToOne
	@JoinColumn(name="room_id")
	private ProvideRoom romm;//所属空间
	
	@OneToMany(mappedBy="commodity",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
	@JSONField(serialize=false)
	private List<ProvideOrderForm> orderforms;
	
	@OneToMany(mappedBy="commodity",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
	//@JSONField(serialize=false)
    private Set<ProvideDemandDocking> demanddocking;
}
